import sdk from "@/store/http/sdkPost";

export default {
	// 模板列表
	// "majorCode": 专业代码,"graphTypeCode": 关系图类, "graphSubTypeCode": 关系图子类 graph_template/select

	async graphTemplateList(params) {
		var result = await sdk.admPost(params, "graph_template/searchPage");
		return result;
	},

	// 模板创建
	//     "majorCode": 专业代码,
	//     "referenceObjectTypeCode": 基准对象类
	//     "graphTypeCode": 关系图类
	//     "graphSubTypeCode": 关系图子类
	//     "templateCode": 标题
	async graphTemplateCreate(params) {
		var result = await sdk.admPost(params, "graph_template/insert");
		return result;
	},

	//专业列表
	async getMajorList() {
		const result = await sdk.admGet({}, "/graph_common/majorList");
		return result;
	},
	//查询关系图类
	async getGrapType(params) {
		const result = await sdk.admPost(params, "/graph_type/select");
		return result;
	},
	//添加关系图类
	async insertGrapType(params) {
		const result = await sdk.admPost(params, "/graph_type/insert");
		return result;
	},
	//获取版本号
	async getVersion(params) {
		const result = await sdk.admPost(params, "/graph_template/nextVersion?groupCode=TYXM&projectId=Pj9909990006&userId=张慧玲");
		return result;
	},
	//查询关系图子类
	async getGraphSubType(params) {
		const result = await sdk.admPost(params, "/graph_sub_type/select");
		return result;
	},
	//添加关系图子类
	async insertGrapSubType(params) {
		const result = await sdk.admPost(params, "/graph_sub_type/insert");
		return result;
	},

	//查询设备之间的关系类型
	async getClassCode(params) {
		const result = await sdk.admPost(params, "/graph_common/relFromToClassCode");
		return result;
	},
	//查询可以链接的设备
	async getClassCodeList(params) {
		const result = await sdk.admPost(params, "/graph_common/relClassCodeList");
		return result;
	},

	// 模板删除
	//      "id":
	async graphTemplateDelete(params) {
		var result = await sdk.admPost(params, "graph_template/delete");
		return result;
	},

	// 模板图例-列表
	async graphTemplateLegendList(params) {
		var result = await sdk.admPost(params, "graph_template_legend/select");
		return result;
	},

	// 模板图例-添加
	async graphTemplateLegendAdd(params) {
		var result = await sdk.admPost(params, "graph_template_legend/insert");
		return result;
	},

	// 模板图例-删除
	async graphTemplateLegendDelete(params) {
		var result = await sdk.admPost(params, "graph_template_legend/delete");
		return result;
	},

	// 模板-加载图形区
	async graphTemplateLoad(params) {
		var result = await sdk.admPost(params, "graph_template/load");
		return result;
	},
	// 模板-画布-在鼠标处添加排版组/机房/图例
	async graphTemplateModify(params) {
		var result = await sdk.admPost(params, "graph_template/modify");
		return result;
	},
	// 画布实例化
	async instantiationLoad(params, query) {
		var result = await sdk.admPost(params, "graph_generate/load?groupCode=" + query.groupCode + "&env=" + query.env + "&projectId=" + query.projectId + "&userId=abc");
		return result;
	},
	// 实例化-查询环境列表
	async instantiationEnv() {
		const result = await sdk.admGet({}, "graph_generate/env");
		return result;
	},
	// 实例化-项目实例列表 专业列表
	async projectList() {
		const result = await sdk.admGet({}, "graph_generate/projectList&userId=abc");
		return result;
	},
	// 实例化查询线段关系
	async getNameByRelType(params) {
		const result = await sdk.admPost(params, "/graph_common/getNameByRelType");
		return result;
	},
	// 模板拷贝
	async copyTemplate(params) {
		const result = await sdk.admPost(params, "/graph_template/copy");
		return result;
	},

	// 查询图例需要的图标列表
	async getClassInfoValues(params) {
		const result = await sdk.admGet({}, "/graph_common/getClassInfoValues/"+params);
		return result;
	},

	// 查询图例使用情况
	async graphLegendUse(params) {
		const result = await sdk.admPost(params, "/graph_legend/use");
		return result;
	},
	// 上传图标
	async uploadIcon(params) {
		const result = await sdk.admPost({file:params.file}, "graph_common/uploadIcon/"+params.oriId+'/'+params.code);
		return result;
	},
	// 查询图标
	async getIcon(params) {
		const result = await sdk.admGet(params, "/graph_common/getIcon/"+params.oriId+'/'+params.code);
		return result;
	},

	async statDic(params) {
		const result = await sdk.jumpPost(params, "/graph_template/statDic");
		return result;
	},


	// 模版规则校验包
	
	async verifyTemplate(params) {
		const result = await sdk.verifyPost({templateIds:[params.id]}, "api/verify/rule/graph/template/queryByTemplateIds?dictVersion="+params.dictVersion);
		return result;
	},
	async getMeoi(params) {
		const result = await sdk.otherGet(params);
		return result;
	},
	async login(params) {
		const result = await sdk.loginPost(params);
		return result;
	},
	async loginInfo(params) {
		const result = await sdk.loginInfoPost(params);
		return result;
	},
	async loginInfoAuthor(params) {
		const result = await sdk.loginInfoPost(params,'/mid-permission-server/Spring/MVC/entrance/unifier/getAuthByUserIdService');
		return result;
	},
};
